package com.letv.core.api;

import android.content.Context;
import android.text.TextUtils;
import com.letv.core.api.UrlConstdata.COMBINE_PARAMETERS;
import com.letv.core.api.UrlConstdata.PUBLIC_PARAMETERS;
import com.letv.core.config.LetvConfig;
import com.letv.core.db.PreferencesManager;
import com.letv.core.network.volley.toolbox.ParameterBuilder;
import com.letv.core.utils.LetvTools;
import com.letv.core.utils.LetvUtils;
import com.letv.core.utils.LogInfo;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.message.BasicNameValuePair;

/**
 * 大媒资接口API *.meizi.app.m.letv.com
 */
public class MediaAssetApi {

    /**
     * 静态请求end
     */
    private static final String STATIC_APP_BASE_END = ".mindex.html";

    private volatile static MediaAssetApi instance;

    protected MediaAssetApi() {
    }

    /**
     * Returns singleton class instance
     */
    public static MediaAssetApi getInstance() {
        if (instance == null) {
            synchronized (MediaAssetApi.class) {
                if (instance == null) {
                    instance = new MediaAssetApi();
                }
            }
        }
        return instance;
    }

    private Context context;

    protected MediaAssetApi(Context context) {
        this.context = context;
    }

    /**
     * Returns singleton class instance
     */
    public static MediaAssetApi getInstance(Context context) {
        if (instance == null) {
            synchronized (MediaAssetApi.class) {
                if (instance == null) {
                    instance = new MediaAssetApi(context);
                }
            }
        }
        return instance;
    }

    /**
     * 得到动态地址
     */
    private String getDynamicUrl() {
        if (LetvConfig.isForTest()) {
            return UrlConstdata.TEST_URL.DYNAMIC_TEST_BASE_URL;
        } else {
            return UrlConstdata.OFFICIAL_URL.MEDIA_ASSET_DYNAMIC_APP_URL;
        }
    }

    /**
     * 得到静态头
     */
    private String getStaticHead() {
        if (LetvConfig.isForTest()) {
            return UrlConstdata.TEST_URL.STATIC_TEST_BASE_HEAD;
        } else {
            return UrlConstdata.OFFICIAL_URL.MEDIA_ASSET_STATIC_APP_HEAD;
        }
    }

    //    private String getLiveUrl() {
    //        if (PreferencesManager.getInstance().isTestApi() && LetvConfig.isForTest()) {
    //            return UrlConstdata.TEST_URL.DYNAMIC_TEST_BASE_URL;
    //        } else {
    //            return UrlConstdata.OFFICIAL_URL.DYNAMIC_APP_LIVE_URL;
    //        }
    //    }

    private interface VIDEO_PLAY_PARAM {

        String DYNAHEAD = "http://api.mob.app.letv.com/play?";

        String TESTHEAD = "http://api.mob.app.letv.com/play?";
    }

    //    public String getPlayUrl() {
    //        if (PreferencesManager.getInstance().isTestApi() && LetvConfig.isForTest()) {
    //            return VIDEO_PLAY_PARAM.TESTHEAD;
    //        } else {
    //            return VIDEO_PLAY_PARAM.DYNAHEAD;
    //        }
    //    }

    public String getPlayUrl(Context context) {
        if (LetvConfig.isForTest()) {
            return VIDEO_PLAY_PARAM.TESTHEAD;
        } else {
            return VIDEO_PLAY_PARAM.DYNAHEAD;
        }
    }

    /**
     * 获取公共静态尾
     *
     * @return
     */
    public static String getStaticEnd() {
        return STATIC_APP_BASE_END;
    }

    /**
     * 请求专题数据包参数
     */
    private interface TOPIC_FILE_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "subject";

        String ACT_VALUE = "detail";

        String ZID_KEY = "zid";

        String TYPE_KEY = "type";
    }

    /**
     * 请求精品应用 /mod/mob/ctl/exchange/act/index
     */
    //    private interface RECOMM_PARAMETERS {
    //        public String MOD_VALUE = "mob";
    //        public String CTL_VALUE = "exchange";
    //        public String ACT_VALUE = "index";
    //
    //        public String EXCHID_KEY = "exchid";
    //        public String PAGE_KEY = "page";
    //        public String PAGESIZE_KEY = "pagesize";
    //        public String MARKID_KEY = "markid";
    //        public String PCODE_KEY = "pcode";
    //        public String VERSION_KEY = "version";
    //    }

    /**
     * 请求发现数据url
     * http://static.meizi.app.m.letv.com/android/mod/mob/ctl/discover/act/index/pcode/{$pcode}/version/{$version}.
     * mindex.html
     *
     * @param markId
     */
    //    public String getFindUrl(String markId) {
    //        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MOD_KEY,
    //            UrlConstdata.DISCOVER_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.CTL_KEY,
    //            UrlConstdata.DISCOVER_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.ACT_KEY,
    //            UrlConstdata.DISCOVER_PARAMETERS.ACT_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MARKID_KEY, markId));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd());
    //    }

    /**
     * 请求专题数据url
     *
     * @param isTopicChannel 是否是热门专题
     * @return
     */
    //    public String getTopicList(boolean isTopicChannel, String markId) {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MOD_KEY,
    //            UrlConstdata.TOPIC_CHANNEL_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.CTL_KEY,
    //            UrlConstdata.TOPIC_CHANNEL_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.ACT_KEY,
    //            isTopicChannel ? UrlConstdata.TOPIC_CHANNEL_PARAMETERS.ACT_TOP_VALUE
    //                : UrlConstdata.TOPIC_CHANNEL_PARAMETERS.ACT_HOT_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MARKID_KEY, markId));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd());
    //    }

    /**
     * 请求专题详情
     *
     * @param zid
     * @param markId
     * @return
     */
    //    public String getTopicDeatil(String zid, String markId) {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MOD_KEY, TOPIC_FILE_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.CTL_KEY, TOPIC_FILE_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.ACT_KEY, TOPIC_FILE_PARAMETERS.ACT_VALUE));
    //        params.add(new BasicNameValuePair(TOPIC_FILE_PARAMETERS.ZID_KEY, zid));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MARKID_KEY, markId));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd());
    //    }
    public String getTopicDeatil(Context context, String zid, String markId) {
        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();

        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MOD_KEY, TOPIC_FILE_PARAMETERS.MOD_VALUE));
        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.CTL_KEY, TOPIC_FILE_PARAMETERS.CTL_VALUE));
        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.ACT_KEY, TOPIC_FILE_PARAMETERS.ACT_VALUE));
        params.add(new BasicNameValuePair(TOPIC_FILE_PARAMETERS.ZID_KEY, zid));
        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MARKID_KEY, markId));
        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode(context)));
        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName(context)));
        return ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd());
    }

    /**
     * 请求服务器时间
     *
     * @return
     */
    //    public String getDateUrl() {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MOD_KEY,
    //            UrlConstdata.GET_DATE_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.CTL_KEY,
    //            UrlConstdata.GET_DATE_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.ACT_KEY,
    //            UrlConstdata.GET_DATE_PARAMETERS.ACT_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getQueryUrl(params, getLiveUrl());
    //    }

    /**
     * @param playid
     *         0:点播 1:直播 2:下载
     * @return
     */
    //    public String getVideoPlayUrl(String cid, String aid, String zid, String vid, String uid, String tss,
    //                                  String playid, String tm) {
    //        List<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
    //        list.add(new BasicNameValuePair("tm", tm));
    //        list.add(new BasicNameValuePair("playid", playid));
    //        list.add(new BasicNameValuePair("tss", tss));
    //        list.add(new BasicNameValuePair("pcode", LetvConfig.getPcode()));
    //        list.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName()));
    //        if (!TextUtils.isEmpty(cid) && !TextUtils.equals("0", cid)) {
    //            list.add(new BasicNameValuePair("cid", cid));
    //        }
    //        if (!TextUtils.isEmpty(zid) && !TextUtils.equals("0", zid)) {
    //            list.add(new BasicNameValuePair("zid", zid));
    //        }
    //        if (!TextUtils.isEmpty(aid) && !TextUtils.equals("0", aid)) {
    //            list.add(new BasicNameValuePair("pid", aid));
    //        }
    //        if (!TextUtils.isEmpty(vid) && !TextUtils.equals("0", vid)) {
    //            list.add(new BasicNameValuePair("vid", vid));
    //        }
    //        if (!TextUtils.isEmpty(uid) && !TextUtils.equals("0", uid)) {
    //            list.add(new BasicNameValuePair("uid", uid));
    //        }
    //        list.add(new BasicNameValuePair("devid", LetvUtils.generate_DeviceId()));
    //        return ParameterBuilder.getQueryUrl(list, getPlayUrl());
    //    }
    public String getVideoPlayUrl(Context context, String cid, String aid, String zid, String vid,
                                  String uid, String tss, String playid, String tm) {
        List<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
        list.add(new BasicNameValuePair("tm", tm));
        list.add(new BasicNameValuePair("playid", playid));
        list.add(new BasicNameValuePair("tss", tss));
        list.add(new BasicNameValuePair("pcode", LetvConfig.getPcode(context)));
        list.add(new BasicNameValuePair("version", LetvUtils.getClientVersionName(context)));
        if (!TextUtils.isEmpty(cid) && !TextUtils.equals("0", cid)) {
            list.add(new BasicNameValuePair("cid", cid));
        }
        if (!TextUtils.isEmpty(zid) && !TextUtils.equals("0", zid)) {
            list.add(new BasicNameValuePair("zid", zid));
        }
        if (!TextUtils.isEmpty(aid) && !TextUtils.equals("0", aid)) {
            list.add(new BasicNameValuePair("pid", aid));
        }
        if (!TextUtils.isEmpty(vid) && !TextUtils.equals("0", vid)) {
            list.add(new BasicNameValuePair("vid", vid));
        }
        if (!TextUtils.isEmpty(uid) && !TextUtils.equals("0", uid)) {
            list.add(new BasicNameValuePair("uid", uid));
        }
        list.add(new BasicNameValuePair("devid", LetvUtils.generate_DeviceId(context)));
        LogInfo.log("sguotao", "getVideoPlayUrl:...url=" +
                ParameterBuilder.getQueryUrl(list, getPlayUrl(context)));
        return ParameterBuilder.getQueryUrl(list, getPlayUrl(context));
    }

    /**
     * 获取请求频道墙频道列表数据的URL
     * <p/>
     * http://wiki.letv.cn/pages/viewpage.action?pageId=45288986
     *
     * @return
     */
    //    public String getChannelListUrl(String markId) {
    //        List<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, CHANNELS_PARAMETERS.MOD_VALUE));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, CHANNELS_PARAMETERS.CTL_VALUE));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, CHANNELS_PARAMETERS.ACT_VALUE));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MARKID_KEY, markId));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getPathUrl(list, getStaticHead(), UrlConstdata.getStaticEnd());
    //    }

    /**
     * 获取请求水印接口
     *
     * @param cid
     * @param pid
     * @return
     */
    //    public String getWaterMarkUrl(int cid, long pid) {
    //        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.LUAMOD_KEY, "main"));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, "mob"));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, "waterMark"));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, "index"));
    //        params.add(new BasicNameValuePair("cid", cid + ""));
    //        params.add(new BasicNameValuePair("pid", pid + ""));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getQueryUrl(params, getDynamicUrl());
    //    }
    public String getWaterMarkUrl(Context context, int cid, long pid) {
        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.LUAMOD_KEY, "main"));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, "mob"));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, "waterMark"));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, "index"));
        params.add(new BasicNameValuePair("cid", cid + ""));
        params.add(new BasicNameValuePair("pid", pid + ""));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode(context)));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName(context)));
        return ParameterBuilder.getQueryUrl(params, getDynamicUrl());
    }

    /**
     * 得到热点视频的地址
     * /mod/mob/ctl/subject/act/detail/pcode/PCODE/version/VERSION.mindex.html"
     */
    //    public String getHotSquareVideoUrl() {
    //        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, "mob"));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, "subject"));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, "detail"));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        LogInfo.log("wlx",
    //            "热点列表 url= " + ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd()));
    //        return ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd());
    //    }

    /*
     * 获取评论头
     */
    protected String getCombineHead() {
        if (PreferencesManager.getInstance().isTestApi()) {
            return LetvHttpApiConfig.TEST_URL.COMBINE_APP_URL_TEST;
        } else {
            return LetvHttpApiConfig.OFFICIAL_URL.COMBINE_APP_URL_NORMAL;
        }
        // return TEST_URL.COMMENT_APP_URL_TEST;
    }

    /**
     * (不)喜欢（评论，回复）接口
     */
    //    private interface COMMENT_LIKE_UNLIKE_PARAMETERS {
    //        public String COMMENT_ID_KEY = "commentid"; // 评论ID
    //        public String ATTR_KEY = "attr"; // 喜欢操作的对象类型,对评论喜欢 cmt;对回复喜欢 reply;默认 cmt
    //        public String ATTR_VALUE_CMT = "cmt"; // 对评论喜欢 cmt
    //        public String ATTR_VALUE_REPLY = "reply"; // 对回复喜欢 reply
    //    }

    /**
     * (不)喜欢（评论，回复）接口
     *
     * @return XDataHull<T> 壳数据
     */
    //    public String getLikeCommentUrl(boolean isLike) {
    //        String baseUrl = "";
    //        if (isLike) {
    //            baseUrl = getCombineHead() + "comment/like";
    //        } else {
    //            baseUrl = getCombineHead() + "comment/unlike";
    //        }
    //        return baseUrl;
    //    }

    //    public HashMap<String, String> getLikeCommentUrlParams(int updataId, String commentId, boolean isLike,
    //                                                           boolean isComment) {
    //        List<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
    //        HashMap<String, String> map = new HashMap<String, String>();
    //
    //        setPostCommonParams(map);
    //
    //        map.put(COMMENT_LIKE_UNLIKE_PARAMETERS.COMMENT_ID_KEY, commentId);
    //        map.put(COMMENT_LIKE_UNLIKE_PARAMETERS.ATTR_KEY, isComment ? COMMENT_LIKE_UNLIKE_PARAMETERS.ATTR_VALUE_CMT
    //            : COMMENT_LIKE_UNLIKE_PARAMETERS.ATTR_VALUE_REPLY);
    //        return map;
    //    }

    //    private void setCommonParams(List<BasicNameValuePair> list) {
    //        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils
    //            .getClientVersionName()));
    //        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.DEVID_KEY, LetvUtils.generate_DeviceId()));
    //    }
    private void setCommonParams(Context context, List<BasicNameValuePair> list) {
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode(context)));
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.VERSION_KEY, LetvTools.getClientVersionName(context)));
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.DEVID_KEY, LetvUtils.generate_DeviceId(context)));
    }

    //    private HashMap<String, String> setPostCommonParams(HashMap<String, String> map) {
    //        map.put(LetvHttpApiConfig.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode());
    //        map.put(LetvHttpApiConfig.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName());
    //        map.put(LetvHttpApiConfig.PUBLIC_PARAMETERS.DEVID_KEY, LetvUtils.generate_DeviceId());
    //        map.put("source", "3");
    //        return map;
    //    }

    private void setCommonCombineParams(List<BasicNameValuePair> list, String cid, String zid,
                                        String vid, String pid) {
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode(context)));
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName(context)));
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.DEVID_KEY, LetvUtils.generate_DeviceId(context)));

        if (!TextUtils.isEmpty(zid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.ZID_KEY, zid));
        }
        if (!TextUtils.isEmpty(vid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.VID_KEY, vid));
        }
        if (!TextUtils.isEmpty(pid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.PID_KEY, pid));
        }
        if (!TextUtils.isEmpty(cid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.CID_KEY, cid));
        }
    }

    private void setCommonCombineParams(Context context, List<BasicNameValuePair> list, String cid,
                                        String zid, String vid, String pid) {
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode(context)));
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName(context)));
        list.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.DEVID_KEY, LetvUtils.generate_DeviceId(context)));

        if (!TextUtils.isEmpty(zid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.ZID_KEY, zid));
        }
        if (!TextUtils.isEmpty(vid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.VID_KEY, vid));
        }
        if (!TextUtils.isEmpty(pid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.PID_KEY, pid));
        }
        if (!TextUtils.isEmpty(cid)) {
            list.add(new BasicNameValuePair(COMBINE_PARAMETERS.CID_KEY, cid));
        }
    }

    /**
     * 新增评论接口
     */
    //    private interface COMMENT_ADD_PARAMETERS {
    //        public String PID_KEY = "pid"; // 专辑ID
    //        public String XID_KEY = "xid"; // 视频ID
    //        public String CID_KEY = "cid"; // 视频所属分类ID
    //        public String CONTENT_KEY = "content"; // 评论内容, 最少3个字，最多140字
    //        /*
    //         * cmt,img,vote
    //         * 所需要类型的评论数：
    //         * cmt：普通评论
    //         * img:图片评论
    //         * vote:投票评论
    //         * 示例：
    //         * 只需要文字评: cmt
    //         * 只需要文字+投票：cmt,vote
    //         */
    //        public String CTYPE_KEY = "ctype";
    //    }

    /**
     * 新增评论接口 POST
     *
     * @param updataId 刷新UI或数据的ID
     * @param pid      专辑ID
     * @param vid      视频ID
     * @param cid      视频所属分类ID
     * @param title    视频标题
     * @param content  评论内容
     * @param parser   解析器
     * @return XDataHull<T> 壳数据
     */
    //    public String addCommentUrl() {
    //        return getCombineHead() + "comment/add";
    //    }

    //    public HashMap<String, String> addCommentUrlParam(String pid, String vid, String cid, String ctype, String content) {
    //        HashMap<String, String> map = new HashMap<String, String>();
    //        setPostCommonParams(map);
    //        map.put(COMMENT_ADD_PARAMETERS.PID_KEY, pid);
    //        map.put(COMMENT_ADD_PARAMETERS.XID_KEY, vid);
    //        map.put(COMMENT_ADD_PARAMETERS.CID_KEY, cid);
    //        map.put(COMMENT_ADD_PARAMETERS.CTYPE_KEY, ctype);
    //        map.put(COMMENT_ADD_PARAMETERS.CONTENT_KEY, content);
    //        return map;
    //    }

    /**
     * 新增回复接口
     */
    //    private interface COMMENT_REPLY_PARAMETERS {
    //        public String PID_KEY = "pid"; // 专辑ID
    //        public String XID_KEY = "xid"; // 视频ID
    //        public String CID_KEY = "cid"; // 视频所属分类ID
    //        public String COMMENT_ID_KEY = "commentid"; // 评论ID
    //        public String REPLY_ID_KEY = "replyid"; // 评论ID
    //        public String CONTENT_KEY = "content"; // 评论内容, 最少3个字，最多140字
    //    }

    /**
     * 获取评论列表接口
     */
    //    private interface COMMENT_LIST_PARAMETERS {
    //        public String PID_KEY = "pid"; // 专辑ID
    //        public String XID_KEY = "xid"; // 视频ID
    //        public String CID_KEY = "cid"; // 频道ID
    //        public String PAGE_KEY = "page"; // 页码
    //        public String ROWS_KEY = "rows"; // 获取的数量
    //        public String ROWS_VALUE = "20"; // 每页20条数据
    //        public String SOURCE = "source"; // 客户端 key
    //    }

    /**
     * 新增回复接口 POST
     *
     * @param updataId  刷新UI或数据的ID
     * @param pid       专辑ID
     * @param vid       视频ID
     * @param cid       视频所属分类ID
     * @param commentId 评论ID
     * @param content   评论内容
     * @param parser    解析器
     * @return XDataHull<T> 壳数据
     */
    //    public String replyCommentUrl() {
    //
    //        return getCombineHead() + "comment/reply";
    //    }

    //    public HashMap<String, String> replyCommentUrlParams(String pid, String vid, String cid, String commentId,
    //                                                         String replyId, String content) {
    //
    //        HashMap<String, String> map = new HashMap<String, String>();
    //
    //        setPostCommonParams(map);
    //        map.put(COMMENT_REPLY_PARAMETERS.PID_KEY, pid);
    //        map.put(COMMENT_REPLY_PARAMETERS.XID_KEY, vid);
    //        map.put(COMMENT_REPLY_PARAMETERS.CID_KEY, cid);
    //        map.put(COMMENT_REPLY_PARAMETERS.COMMENT_ID_KEY, commentId);
    //        map.put(COMMENT_REPLY_PARAMETERS.REPLY_ID_KEY, replyId);
    //        map.put(COMMENT_REPLY_PARAMETERS.CONTENT_KEY, content);
    //        return map;
    //    }

    /**
     * 获取评论列表接口 GET
     *
     * @param updataId 刷新UI或数据的ID
     * @param pid      专辑ID
     * @param vid      视频ID
     * @param page     页码
     * @param cid      频道id
     * @param parser   解析器
     * @return XDataHull<T> 壳数据
     */
    //    public String requestCommentListUrl(String pid, String vid, int page, String cid) {
    //        String baseUrl = getCombineHead() + "comment/list";
    //
    //        List<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
    //        setCommonParams(list);
    //        list.add(new BasicNameValuePair(COMMENT_LIST_PARAMETERS.PID_KEY, pid));
    //        list.add(new BasicNameValuePair(COMMENT_LIST_PARAMETERS.XID_KEY, vid));
    //        list.add(new BasicNameValuePair(COMMENT_LIST_PARAMETERS.CID_KEY, cid));
    //        list.add(new BasicNameValuePair(COMMENT_LIST_PARAMETERS.PAGE_KEY, String.valueOf(page)));
    //        list.add(new BasicNameValuePair(COMMENT_LIST_PARAMETERS.ROWS_KEY, COMMENT_LIST_PARAMETERS.ROWS_VALUE));
    //        list.add(new BasicNameValuePair(COMMENT_LIST_PARAMETERS.SOURCE, "3"));
    //        return ParameterBuilder.getQueryUrl(list, baseUrl);
    //    }

    /**
     * 评论回复列表接口
     */
    //    private interface COMMENT_REPLY_LIST_PARAMETERS {
    //        public String COMMENT_ID_KEY = "commentid"; // 评论ID
    //        public String PAGE_KEY = "page"; // 页码
    //        public String PAGE_VALUE = "1";
    //        public String ROWS_KEY = "rows"; // 获取的数量
    //        public String SOURCE = "source"; // 获取的数量
    //    }

    /**
     * 评论回复列表接口 GET
     *
     * @param updataId  刷新UI或数据的ID
     * @param commentId 评论ID
     * @param parser    解析器
     * @return XDataHull<T> 壳数据
     */
    //    public String requestReplyListUrl(String commentId) {
    //        String baseUrl = getCombineHead() + "comment/replylist";
    //
    //        ArrayList<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
    //        setCommonParams(list);
    //        list.add(new BasicNameValuePair(COMMENT_REPLY_LIST_PARAMETERS.COMMENT_ID_KEY, commentId));
    //        list.add(new BasicNameValuePair(COMMENT_REPLY_LIST_PARAMETERS.PAGE_KEY,
    //            COMMENT_REPLY_LIST_PARAMETERS.PAGE_VALUE));
    //        list.add(new BasicNameValuePair(COMMENT_REPLY_LIST_PARAMETERS.ROWS_KEY, COMMENT_LIST_PARAMETERS.ROWS_VALUE));
    //        list.add(new BasicNameValuePair(COMMENT_REPLY_LIST_PARAMETERS.SOURCE, "3"));
    //
    //        return ParameterBuilder.getQueryUrl(list, baseUrl);
    //    }

    /**
     * 请求推荐页数据参数（5.1新接口）
     */
    //    private interface FLOATBALL_PARAMETERS {
    //        public String MOD_VALUE = "mob";
    //        public String CTL_VALUE = "floatball";
    //        public String ACT_VALUE = "index";
    //    }

    /**
     * 请求浮球数据(静态)（5.6新接口） get
     *
     * @return XDataHull<T> 壳数据
     */
    //    public String requestFloatBallUrl() {
    //        String baseUrl = getDynamicUrl();
    //        List<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, FLOATBALL_PARAMETERS.MOD_VALUE));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, FLOATBALL_PARAMETERS.CTL_VALUE));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, FLOATBALL_PARAMETERS.ACT_VALUE));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.PCODE_KEY, LetvHttpApiConfig.PCODE));
    //        list.add(new BasicNameValuePair(PUBLIC_PARAMETERS.VERSION_KEY, LetvHttpApiConfig.VERSION));
    //        return ParameterBuilder.getQueryUrl(list, baseUrl);
    //    }

    /*
     * 获取推荐应用数据Url
     */
    //    public String getRecommDataUrl(String exchid, int page, int pagesize, String markid) {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, RECOMM_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, RECOMM_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, RECOMM_PARAMETERS.ACT_VALUE));
    //        if (null != exchid && !"".equals(exchid))
    //            params.add(new BasicNameValuePair(RECOMM_PARAMETERS.EXCHID_KEY, exchid));
    //        params.add(new BasicNameValuePair(RECOMM_PARAMETERS.PAGE_KEY, String.valueOf(page)));
    //        params.add(new BasicNameValuePair(RECOMM_PARAMETERS.PAGESIZE_KEY, String.valueOf(pagesize)));
    //        params.add(new BasicNameValuePair(RECOMM_PARAMETERS.MARKID_KEY, markid));
    //        params.add(new BasicNameValuePair(RECOMM_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(RECOMM_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //
    //        return ParameterBuilder.getPathUrl(params, getStaticHead(), getStaticEnd());
    //    }

    /*
     * 获取Tab签请求合并接口
     */
    public String getCombineTabDataUrl(Context context, String markId, String cid, String zid,
                                       String vid, String pid) {
        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        if (null != context) {
            setCommonParams(context, params);
        }
        if (!TextUtils.isEmpty(zid)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.ZID_KEY, zid));
        }
        if (!TextUtils.isEmpty(vid)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.VID_KEY, vid));
        }
        if (!TextUtils.isEmpty(pid)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.PID_KEY, pid));
        }
        if (!TextUtils.isEmpty(cid)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.CID_KEY, cid));
        }

        LogInfo.log("sguotao", "获取Tab签请求合并接口:...url=" +
                ParameterBuilder.getQueryUrl(params, getCombineHead() + "play/tabs"));
        return ParameterBuilder.getQueryUrl(params, getCombineHead() + "play/tabs");
    }

    /**
     * 请求包含接口合并所有数据的接口
     *
     * @param updateId
     * @param cid
     * @param zid
     * @param vid
     * @param pid
     * @return
     */
    //    public String getIntroduceDataUrl(String markId, String cid, String zid, String vid, String pid) {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        setCommonCombineParams(params, cid, zid, vid, pid);
    //        return ParameterBuilder.getQueryUrl(params, getCombineHead() + "play/desc");
    //    }

    /**
     * 专题专题专辑数据接口
     *
     * @param updataId
     * @param zid
     * @param markId
     * @param parser
     * @return
     */
    //    public String getTopicAlbumDataUrl(String markId, String zid) {
    //        String head = getStaticHead();
    //        String end = getStaticEnd();
    //
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, TOPIC_FILE_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, TOPIC_FILE_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, TOPIC_FILE_PARAMETERS.ACT_VALUE));
    //        params.add(new BasicNameValuePair(TOPIC_FILE_PARAMETERS.ZID_KEY, zid));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MARKID_KEY, markId));
    //        params.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(LetvHttpApiConfig.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils
    //            .getClientVersionName()));
    //
    //        return ParameterBuilder.getPathUrl(params, head, end);
    //    }

    /**
     * 猜你喜欢接口
     *
     * @param vid
     * @param pid
     * @param cid
     * @return
     */
    public String getRelateUrl(String vid, String pid, String cid) {
        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        setCommonCombineParams(params, cid, "", vid, pid);
        return ParameterBuilder.getQueryUrl(params, getCombineHead() + "play/relate");

    }

    //    public String getCombineDataVListUrl(String pid, String pagenum, String pagesize) {
    //        return getCombineDataVListUrl("", "", "", "", pid, pagenum, pagesize, "", "");
    //    }

    //    public String getCombineDataVListByDateUrl(String updataId, String cid, String zid, String vid, String pid,
    //                                               String pagenum, String pagesize, String year, String month) {
    //        return getCombineDataVListUrl("", "", "", "", pid, "", "", year, month);
    //    }

    /**
     * 请求包含接口合并所有数据的接口
     *
     * @param cid
     * @param zid
     * @param vid
     * @param pid
     * @return
     */
    //    public String getCombineDataVListUrl(String updataId, String cid, String zid, String vid, String pid,
    //                                         String pagenum, String pagesize, String year, String month) {
    //
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        setCommonCombineParams(params, cid, zid, vid, pid);
    //
    //        if (!TextUtils.isEmpty(pagenum)) {
    //            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.PAGENUM_KEY, pagenum));
    //        }
    //        if (!TextUtils.isEmpty(pagesize)) {
    //            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.PAGESIZE_KEY, pagesize));
    //        }
    //        if (!TextUtils.isEmpty(year)) {
    //            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.YEAR_KEY, year));
    //        }
    //        if (!TextUtils.isEmpty(month)) {
    //            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.MONTH_KEY, month));
    //        }
    //
    //        return ParameterBuilder.getQueryUrl(params, getCombineHead() + "play/vlist");
    //    }
    public String getCombineDataVListUrl(Context context, String updataId, String cid, String zid,
                                         String vid, String pid, String pagenum, String pagesize,
                                         String year, String month) {

        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        setCommonCombineParams(context, params, cid, zid, vid, pid);

        if (!TextUtils.isEmpty(pagenum)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.PAGENUM_KEY, pagenum));
        }
        if (!TextUtils.isEmpty(pagesize)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.PAGESIZE_KEY, pagesize));
        }
        if (!TextUtils.isEmpty(year)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.YEAR_KEY, year));
        }
        if (!TextUtils.isEmpty(month)) {
            params.add(new BasicNameValuePair(COMBINE_PARAMETERS.MONTH_KEY, month));
        }

        return ParameterBuilder.getQueryUrl(params, getCombineHead() + "play/vlist");
    }

    /**
     * 视频列表
     *
     * @param id
     * @param vid
     * @param page
     * @param count
     * @param merge
     * @return
     */
    //    public String getVideoList(String id, String vid, String page, String count, String o, String merge, String markId) {
    //        String head = getStaticHead();
    //        String end = UrlConstdata.getStaticEnd();
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MOD_KEY, VIDEOS_LIST_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.CTL_KEY, VIDEOS_LIST_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.ACT_KEY, VIDEOS_LIST_PARAMETERS.ACT_VALUE));
    //        params.add(new BasicNameValuePair(VIDEOS_LIST_PARAMETERS.ID_KEY, id));
    //        params.add(new BasicNameValuePair(VIDEOS_LIST_PARAMETERS.VID_KEY, vid));
    //        params.add(new BasicNameValuePair(VIDEOS_LIST_PARAMETERS.B_KEY, page));
    //        params.add(new BasicNameValuePair(VIDEOS_LIST_PARAMETERS.S_KEY, count));
    //        params.add(new BasicNameValuePair(VIDEOS_LIST_PARAMETERS.O_KEY, o));
    //        params.add(new BasicNameValuePair(VIDEOS_LIST_PARAMETERS.M_KEY, merge));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MARKID_KEY, markId));
    //
    //        return ParameterBuilder.getPathUrl(params, head, end);
    //    }

    /**
     * 批量取得专辑、视频播放数 （动态）
     *
     * @param updataId 刷新UI或数据的ID
     * @param parser   解析器
     * @return XDataHull<T> 壳数据
     */
    //    public String getPAlbumVideoPlayCount(String ids, String type) {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.LUAMOD_KEY, "main"));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.MOD_KEY, "mob"));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.ACT_KEY, "index"));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.CTL_KEY, "getPidsInfo"));
    //        params.add(new BasicNameValuePair("type", type));
    //        params.add(new BasicNameValuePair("ids", ids));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(UrlConstdata.PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getQueryUrl(params, getDynamicUrl());
    //    }

    /**
     * @author haitian 通过视频id获取视频或专辑详情
     */
    private interface GETALBUMBYID_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "getalbumbyid";

        String ACT_VALUE = "detail";
    }

    /**
     * 通过视频id获取专辑详情
     */
    //    public String requestGetAlbumByIdUrl(String id) {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, GETALBUMBYID_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, GETALBUMBYID_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, GETALBUMBYID_PARAMETERS.ACT_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ID_KEY, id));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode()));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName()));
    //        return ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd());
    //    }
    public String requestGetAlbumByIdUrl(Context context, String id) {
        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, GETALBUMBYID_PARAMETERS.MOD_VALUE));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, GETALBUMBYID_PARAMETERS.CTL_VALUE));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, GETALBUMBYID_PARAMETERS.ACT_VALUE));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ID_KEY, id));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.PCODE_KEY, LetvConfig.getPcode(context)));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.VERSION_KEY, LetvUtils.getClientVersionName(context)));
        LogInfo.log("sguotao", "通过视频id获取专辑详情 getAlbumById..url=" +
                ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd()));
        return ParameterBuilder.getPathUrl(params, getStaticHead(), UrlConstdata.getStaticEnd());
    }

    /**
     * 请求视频连播接口参数
     * http://dynamic.recommend.app.m.letv.com/android/dynamic.php?
     * mod=mob&ctl=playrecommend&act=index&devid={$devid}&uid={$uid}
     * &cid={$cid}&pid={$pid}&vid={$vid}&pcode={$pcode}&version={$version}
     */
    private interface PLAY_RECOMMEND_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "playrecommend";

        String ACT_VALUE = "index";

        String UID_KEY = "uid";// 未登录时不传，登陆时必传

        String CID_KEY = "cid";

        String PID_KEY = "pid";// 没有专辑id时忽略此参数

        String VID_KEY = "vid";
    }

    /**
     * 请求首页个性化推荐接口（静态）
     *
     * @return XDataHull<T> 壳数据
     */
    //    public String getRequestPlayRecommendurl(String markId, String cid, String pid, String vid) {
    //        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
    //        setCommonParams(params);
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, PLAY_RECOMMEND_PARAMETERS.MOD_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, PLAY_RECOMMEND_PARAMETERS.CTL_VALUE));
    //        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, PLAY_RECOMMEND_PARAMETERS.ACT_VALUE));
    //        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.UID_KEY,
    //            PreferencesManager.getInstance().isLogin() ? PreferencesManager.getInstance().getUserId() : ""));
    //        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.CID_KEY, cid));
    //        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.PID_KEY, pid));
    //        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.VID_KEY, vid));
    //
    //        return ParameterBuilder.getQueryUrl(params, getDynamicUrl());
    //    }
    public String getRequestPlayRecommendurl(Context context, String markId, String cid, String pid,
                                             String vid) {
        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        setCommonParams(context, params);
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.MOD_KEY, PLAY_RECOMMEND_PARAMETERS.MOD_VALUE));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.CTL_KEY, PLAY_RECOMMEND_PARAMETERS.CTL_VALUE));
        params.add(new BasicNameValuePair(PUBLIC_PARAMETERS.ACT_KEY, PLAY_RECOMMEND_PARAMETERS.ACT_VALUE));
        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.UID_KEY,
                PreferencesManager.getInstance().isLogin() ? PreferencesManager.getInstance()
                                                                               .getUserId() : ""));
        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.CID_KEY, cid));
        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.PID_KEY, pid));
        params.add(new BasicNameValuePair(PLAY_RECOMMEND_PARAMETERS.VID_KEY, vid));

        return ParameterBuilder.getQueryUrl(params, getDynamicUrl());
    }

    /**
     * 下载Url
     * http://dynamic.meizi.app.m.letv.com/android/dynamic.php?mod=minfo&ctl=videofile&act=index&mmsid={$mmsid}&playid={$playid}&tss={$tss}&pcode={$pcode}&version={$version}&vid={$vid}
     *
     * @param context
     * @param mmsid
     * @param tm
     * @param key
     * @return
     */
    public String getDownloadUrl(Context context, String mmsid, String tss, String tm, String key,
                                 long vid) {
        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        //        setCommonParams(context, params);
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.MMSID, mmsid));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.PLAYID, String.valueOf(2)));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.TSS, tss));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.ISLOGIN, ""));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.TM, tm));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.KEY, key));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.VID, String.valueOf(vid)));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.LEVEL_TYPE, String.valueOf(2)));

        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.MOD, "minfo"));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.CTL, "videofile"));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.ACT, "index"));

        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.PCODE, LetvConfig.getPcode(context)));
        params.add(new BasicNameValuePair(UrlConstdata.DOWNLOAD_PARAMETERS.VERSION, LetvUtils.getClientVersionName(context)));

        LogInfo.log("sguotao", "下载地址:" + ParameterBuilder.getQueryUrl(params, getDynamicUrl()));
        return ParameterBuilder.getQueryUrl(params, getDynamicUrl());
    }
}
